function create_image(img_name, x, y){
	// create container div element
	var div_id = get_new_elementId("div");
	var div = create_html_element("card", "div", div_id, "");
	
	// create img tag and add to tree
	var img_id = get_new_elementId("img");
	var img = create_img_tag(div_id, img_id, img_name);
	
	div.addClass("image-element").attr("type", "image");
	
	// calculate position to put the div
	cardPx = $("#card").offset().left;
	cardPy = $("#card").offset().top;
	
	div.css("left", x-cardPx+"px").css("top", y-cardPy+"px").css("z-index", zIndexMax);
	
	// make the div resizable and draggable
	div.draggable({
		start: function(event, ui) {
			ui.helper.data("dragging", true);	// prevent from click handler firing
        },
        stop: function(event, ui) {
            setTimeout(function(){ui.helper.data("dragging", false);}, 300);
        }
	});
	div.resizable();
	div.rotatable();
}

function create_text(x, y){
	var div_id = get_new_elementId("div");
	var div = create_html_element("card", "div", div_id, "New Text");
	
	div.addClass("text-element").attr("type", "text");
	// calculate position to put the div
	cardPx = $("#card").offset().left;
	cardPy = $("#card").offset().top;
	
	//alert(x-cardPx);
	div.css("left", x-cardPx+"px").css("top", y-cardPy+"px").css("z-index", zIndexMax);
	
	// make the div resizable and draggable
	div.draggable({
		start: function(event, ui) {
			ui.helper.data("dragging", true);	// prevent from click handler firing
        },
        stop: function(event, ui) {
            setTimeout(function(){ui.helper.data("dragging", false);}, 300);
        }
	});
	div.resizable();
	div.rotatable();
}